﻿/*========================== 
 * @author 郑金泉
 * @desc SQL 数据查询操作字段信息类
 * ========================= */
using System;
using System.Collections.Generic;
using System.Text;

using Obsidian.Edm;

namespace Obsidian.Data.Sql
{
    public class OperateField
    {

        private IModelField _modelField;
        private object _value;
        private OperType _operType = OperType.Not;

        public OperateField(IModelField field)
        {
            this._modelField = field;
        }

        public OperateField(IModelField field, object value)
        {
            this._modelField = field;
            this._value = value;
        }

        public IModelField ModelField
        {
            get { return this._modelField; }
        }

        public object Value
        {
            get { return this._value; }
            set { this._value = value; }
        }

        public object DbValue
        {
            get
            {
                return this._value == null ? Convert.DBNull : this._value;
            }
        }

        public OperType OperType
        {
            get { return this._operType; }
            set { this._operType = value; }
        }

    }

    public enum OperType
    {
        /// <summary>
        /// 未设置
        /// </summary>
        Not,
        /// <summary>
        /// 自增
        /// </summary>
        Increase
    }

}
